home *** CD-ROM | disk | FTP | other *** search
- package asp.wizard;
-
- import asp.netobjects.nfx.util.ExceptionHandler;
- import asp.netobjects.nfx.util.ExternalError;
- import asp.netobjects.nfx.util.InternalError;
- import asp.netobjects.nfx.wizard.Wizard;
- import asp.netobjects.nfx.wizard.WizardPage;
- import asp.netobjects.nfx.wizard.WizardView;
- import asp.util.EResourceUtil;
- import asp.util.ResourceUtil;
- import asp.wizard.def.DefConnection;
- import asp.wizard.util.UiUtil;
- import com.sun.java.swing.ImageIcon;
- import com.sun.java.swing.JFrame;
- import java.awt.Component;
- import java.awt.Dialog;
- import java.awt.Font;
- import java.awt.Frame;
- import java.awt.Window;
- import java.awt.event.ActionEvent;
- import java.awt.event.WindowEvent;
- import java.net.URL;
- import java.util.Hashtable;
- import java.util.Observable;
-
- public class WizardSubDbQuery extends Wizard {
- private static final String ID_LBL_TITLE = "window.title";
- private static final String ID_BTN_BUILDSQL = "button.buildsql";
- private static final String IMG_DIR = "image";
- private static final String BUTTON_CANCEL = "button.cancel";
- private static final String BUTTON_BACK = "button.back";
- private static final String BUTTON_NEXT = "button.next";
- private static final String BUTTON_FINISH = "button.finish";
- private static WizardSubDbQuery _instance = null;
- private DefConnection _defConnection;
- private WizardModelDbQuery _owner;
- private ResourceUtil _resourceUtil;
- private SubDBQueryData _data = new SubDBQueryData();
-
- public static void main(String[] args) {
- JFrame f = new JFrame();
- WizardSubDbQuery wiz = new WizardSubDbQuery(f, "Test", (String)null, 540, 400, (ExceptionHandler)null);
- WizardView wv = ((Wizard)wiz).getView();
- ((Window)wv).addWindowListener(new 1());
- ((Wizard)wiz).setVisible(true);
- }
-
- public SubDBQueryData getData() {
- return this._data;
- }
-
- public void clearValues() {
- this._data.clear();
- }
-
- public static WizardSubDbQuery getInstance() {
- if (_instance == null) {
- JFrame f = new JFrame();
- ((Component)f).setFont(new Font("Dialog", 0, 11));
- _instance = new WizardSubDbQuery(f, (String)null, (String)null, 540, 400, new AspWizardExceptionHandler(f));
- }
-
- return _instance;
- }
-
- public WizardSubDbQuery(JFrame parent, String title, String codeBase, int width, int height, ExceptionHandler handler) {
- super(parent, title, codeBase, width, height, handler);
- this.init_internal();
- }
-
- public WizardSubDbQuery(JFrame parent, String title, String codeBase, ExceptionHandler handler) {
- super(parent, title, codeBase, handler);
- this.init_internal();
- }
-
- protected void init_internal() {
- this._data.setWizard(this);
- this.initResourceUtil();
- this.initView();
- this.initSequence();
- this.initListeners();
- ((Wizard)this).enableButtons();
- }
-
- private void initResourceUtil() {
- try {
- this._resourceUtil = new ResourceUtil("asp.wizard.res", this.getClass());
- } catch (EResourceUtil e) {
- System.err.println(((Throwable)e).getMessage());
- }
-
- }
-
- private void initSequence() {
- try {
- WizardModelAbstract model = new WizardModelSubDbQuerySelect(this, (String)null, (String)null, (ImageIcon)null, (ExceptionHandler)null);
- ((Wizard)this).add(model);
- } catch (InternalError e) {
- System.err.println(((Throwable)e).getMessage());
- }
-
- }
-
- private void initView() {
- WizardView wv = ((Wizard)this).getView();
- if (wv != null) {
- ((Dialog)wv).setTitle(this._resourceUtil.getString("window.title"));
- URL u = this.getClass().getResource("image/transicon.gif");
- if (u != null) {
- ImageIcon icon = new ImageIcon(u);
- if (wv instanceof Frame) {
- ((Frame)wv).setIconImage(icon.getImage());
- }
- }
-
- wv.getCancelButton().setText(this._resourceUtil.getString("button.cancel"));
- wv.getBackButton().setText(this._resourceUtil.getString("button.back"));
- wv.getNextButton().setText(this._resourceUtil.getString("button.next"));
- wv.getFinishButton().setText(this._resourceUtil.getString("button.finish"));
- UiUtil.centerComponentInScreen(wv);
- ((Dialog)wv).setResizable(false);
- }
-
- }
-
- private void initListeners() {
- ((Wizard)this).getView().addWindowListener(new 2(this));
- }
-
- private void handleFinishButtonPressed(ActionEvent e) {
- }
-
- private void handleWindowClosing(WindowEvent e) {
- ((Observable)this).setChanged();
- ((Observable)this).notifyObservers(e);
- }
-
- private void handleWindowClosed(WindowEvent e) {
- ((Observable)this).setChanged();
- ((Observable)this).notifyObservers(e);
- }
-
- public String getSelect() {
- return this._data.getSelect();
- }
-
- public String getFrom() {
- String from = "";
-
- try {
- from = this._data.getFrom();
- } catch (Exception var2) {
- }
-
- return from;
- }
-
- public String getWhere() {
- return this._data.getWhere();
- }
-
- public String getOrderBy() {
- return this._data.getOrderby();
- }
-
- public DefConnection getDefConnection() {
- return this._defConnection;
- }
-
- public void setDefConnection(DefConnection defConnection) {
- this._defConnection = defConnection;
- }
-
- public void destroy() {
- }
-
- public void initialize() throws InternalError, ExternalError {
- super.initialize();
- WizardPage model = (WizardPage)((Wizard)this).getPageIndex().get("1");
- if (model != null) {
- model.initialize(1);
- if (!model.getView().isVisible()) {
- model.getView().setVisible(true);
- }
- }
-
- ((Wizard)this).enableButtons();
- }
-
- public WizardPage getLastPage() {
- WizardPage result = null;
- Hashtable models = ((Wizard)this).getPageIndex();
- new String();
- String key = String.valueOf(models.size());
- result = (WizardPage)models.get(key);
- return result;
- }
-
- public void finish() throws InternalError, ExternalError {
- ((Wizard)this).getCurrPage().validate();
- ((Wizard)this).getCurrPage().commit();
- ((Observable)this).setChanged();
- ((Observable)this).notifyObservers();
- }
-
- // $FF: synthetic method
- static void access$0(WizardSubDbQuery $0, WindowEvent $1) {
- $0.handleWindowClosing($1);
- }
-
- // $FF: synthetic method
- static void access$1(WizardSubDbQuery $0, WindowEvent $1) {
- $0.handleWindowClosed($1);
- }
- }
-